<?php

include("class.phpmailer.php");//加载phpmailer主类，一般情况下要设定好phpmailer路径
include("class.smtp.php"); // 加载smtp类，一般情况下要设定好phpmailer路径
require_once('config.php');


	$name = $_POST['name'];
	$course = $_POST['course'];
	$courseNum = $_POST['courseNum'];
	$skype = $_POST['skype'];
	$tel = $_POST['tel'];
	$email = $_POST['email'];
	$startDate = $_POST['startDate'];
	$startTime = $_POST['startTime'];
	$whybilin = $_POST['whybilin'];
	
	
	
	$course = $_POST['course'];
	$courseNum= (int)$_POST['courseNum'];
	
	($course != 'A' && $course != 'B') ? exit('参数有误.请重新填写表单.') : '';
	
	$coursePrice['A'] = 70 ;
	$coursePrice['B'] = 120 ;
	$total_fee = $coursePrice[ $course ] * $courseNum;
	
	$mail -> CharSet = 'UTF-8'; 
	
	
	$mail->AddAddress('bilineducation2010@gmail.com' ,'bilineducation');
	$mail->AddAddress( $email ,$name);
	
	
	
	
	$ID = 'BL'.date('YmdHis',time()) ;
	
	
	$title = '尊敬的'.  $name .',这是您在Bilin的课程预约订单详细信息，请妥善保管。';
	$hi = '<p>尊敬的<strong>'.  $name .'</strong>：<br />您已完成Bilin课程预约，订单号码为：'. $ID  .'。以下是订单的详细信息。<br /></p>';
	
	
	$mail->Subject = $title ;
	$mail->Body = $hi .'<table  border="1" width="485" cellspacing="0" cellpadding="10"><tr><td width="148">选择课程种类:</td><td width="291">'. $course .'('.$coursePrice[ $course ].'元/节)' .'&nbsp;</td></tr><tr><td>课程数量，</td><td>'. $courseNum .'&nbsp;</td></tr><tr><td>Skype账户</td><td>'. $skype .'&nbsp;</td></tr><tr><td>电话号码</td><td>'. $tel .'&nbsp;</td></tr><tr><td>邮箱</td><td>'. $email .'&nbsp;</td></tr><tr><td>姓名</td><td>'. $tel .'&nbsp;</td></tr><tr><td>希望开课日期和时间</td><td>'. $startDate .'&nbsp;'. $startTime .'&nbsp;</td></tr><tr><td>为什么选择Bilin可选）</td><td>'. $whybilin .'&nbsp;</td></tr></table><p>感谢您对Bilin的支持 Bilin<br />Email: <a href="mailto:contactus@bilineducation.com">contactus@bilineducation.com</a><br />电话:  +86-159-2141-3916; +86-136-3664-3173<br />通信地址：上海政立路639弄3号204室</p>' ;
	//$mail->Body = 'dddddddddddddddddd' ;
	//$mail->AltBody = "This is the body when user views in plain text format"; //纯文字时的Body
	if(!$mail->Send())
	{
	echo "Mailer Error: " . $mail->ErrorInfo;
	}else{
		$returnInfo =  'OK';
	}
	
	//header("Content-type: text/html; charset=utf-8");
	require_once('../alipay/index.php');


?>
